import request from "@/utils/request";
import type { BannerItemVO, CategoryItemVO, GuessItemVO, HotItemVO, PageDTO } from "@/types/homeType";
import type { Page, Response } from "@/types/response";

enum ENUM {
   fetchBannerListAPI = "/home/banner",
   fetchNavListAPI = "/home/category/mutli",
   fetchHotListAPI = "/home/hot/mutli",
   fetchGuessListAPI = "/home/goods/guessLike",
   fetchNewListAPI="/home/new"
}

/**
 * @description 获取轮播图的接口
 * */
export const fetchBannerListAPI = (distributionSite: number = 1): Promise<Response<BannerItemVO[]>> => request<BannerItemVO[]>({
   url: `${ENUM.fetchBannerListAPI}`,
   method: "GET",
   data: {
      distributionSite,
   },
});

/**
 * @description 获取分类导航的接口
 * */
export const fetchNavListAPI = (): Promise<Response<CategoryItemVO[]>> => request<CategoryItemVO[]>({
   url: `${ENUM.fetchNavListAPI}`,
   method: "GET",
});

/**
 * @description 获取热门推荐的接口
 * */
export const fetchHotListAPI = (): Promise<Response<HotItemVO[]>> => request<HotItemVO[]>({
   url: `${ENUM.fetchHotListAPI}`,
   method: "GET",
});

/**
 * @description 获取猜你喜欢列表的接口
 * */
export const fetchGuessListAPI = (page: PageDTO): Promise<Response<Page<GuessItemVO[]>>> => request<Page<GuessItemVO[]>>({
   url: ENUM.fetchGuessListAPI,
   method: "GET",
   data: page,

});
/**
 * @description 获取新鲜好物的接口
 * */
export const fetchNewListAPI=(limit:number)=>request<GuessItemVO[]>({
   url:ENUM.fetchNewListAPI,
   method: "GET",
   data:{
      limit
   }
})